home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / PrintTraps.p < prev    next >
Encoding:
Text File  |  1991-04-05  |  9.9 KB  |  393 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {
  4. Created: Tuesday, August 2, 1988 at 9:06 AM
  5.     PrintTraps.p
  6.     Pascal Interface to the Macintosh Libraries
  7.  
  8.     Copyright Apple Computer, Inc.    1985-1988
  9.     All rights reserved
  10. }
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18.     UNIT PrintTraps;
  19.     INTERFACE
  20.     USES
  21.         Types, Quickdraw, Dialogs;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. CONST
  39. bDraftLoop = 0;
  40. bSpoolLoop = 1;
  41. iPFMaxPgs = 128;                        {Max number of pages in a print file.}
  42. iPrPgFract = 120;
  43. iPrPgFst = 1;                            {Page range constants}
  44. iPrPgMax = 9999;
  45. iPrRelease = 2;                         {Current version number of the code.}
  46. iPrSavPFil = -1;
  47. iIOAbort = -27;
  48. pPrGlobals = $00000944;
  49. bUser1Loop = 2;
  50. bUser2Loop = 3;
  51. fNewRunBit = 2;                         {Bit 2 (3rd bit) in bDocLoop is new JobRun indicator.}
  52. fHiResOK = 3;                            {Bit 3 (4th bit) in bDocLoop is hi res indicator for paint.}
  53. fWeOpenedRF = 4;                        {Bit 4 (5th bit) in bDocLoop is set if driver opened the pr res file.}
  54. iPrAbort = 128;
  55. iPrDevCtl = 7;                            {The PrDevCtl Proc's ctl number}
  56. lPrReset = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  57. lPrLineFeed = $00030000;
  58. lPrLFStd = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  59. lPrLFSixth = $0003FFFF;
  60. lPrPageEnd = $00020000;                 {The PrDevCtl Proc's CParam for end page}
  61. lPrDocOpen = $00010000;                 {note: same as lPrReset low order byte indicates number of copies to print}
  62. lPrPageOpen = $00040000;
  63. lPrPageClose = $00020000;                {note: same as lPrPageEnd}
  64. lPrDocClose = $00050000;
  65. iFMgrCtl = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  66. iMscCtl = 9;                            {Msc Text state / Drvr State ctl number}
  67. iPvtCtl = 10;                            {Private ctls start here}
  68. iMemFullErr = -108;
  69.  
  70. {
  71. Driver constants}
  72.  
  73. iPrBitsCtl = 4;                         {The Bitmap Print Proc's ctl number}
  74. lScreenBits = 0;                        {The Bitmap Print Proc's Screen Bitmap param}
  75. lPaintBits = 1;                         {The Bitmap Print Proc's Paint [sq pix] param}
  76. lHiScreenBits = $00000002;                {The Bitmap Print Proc's Screen Bitmap param}
  77. lHiPaintBits = $00000003;                {The Bitmap Print Proc's Paint [sq pix] param}
  78. iPrIOCtl = 5;                            {The Raw Byte IO Proc's ctl number}
  79. iPrEvtCtl = 6;                            {The PrEvent Proc's ctl number}
  80. lPrEvtAll = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  81. lPrEvtTop = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  82. iPrDrvrRef = -3;
  83. getRslDataOp = 4;                        {PrGeneral Cs}
  84. setRslOp = 5;                            {PrGeneral Cs}
  85. draftBitsOp = 6;                        {PrGeneral Cs}
  86. noDraftBitsOp = 7;                        {PrGeneral Cs}
  87. getRotnOp = 8;                            {PrGeneral Cs}
  88. NoSuchRsl = 1;                            {PrGeneral Cs}
  89. RgType1 = 1;                            {PrGeneral Cs}
  90.  
  91.  
  92. TYPE
  93.  
  94. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  95.  
  96. TScan = (scanTB,scanBT,scanLR,scanRL);
  97.  
  98.  
  99. TPPrPort = ^TPrPort;
  100. TPrPort = RECORD
  101.     gPort: GrafPort;                    {The Printer's graf port.}
  102.     gProcs: QDProcs;                    {..and its procs}
  103.     lGParam1: LONGINT;                    {16 bytes for private parameter storage.}
  104.     lGParam2: LONGINT;
  105.     lGParam3: LONGINT;
  106.     lGParam4: LONGINT;
  107.     fOurPtr: BOOLEAN;                    {Whether the PrPort allocation was done by us.}
  108.     fOurBits: BOOLEAN;                    {Whether the BitMap allocation was done by us.}
  109.     END;
  110.  
  111. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  112. This is the "PrPeek" record.}
  113.  
  114. TPPrInfo = ^TPrInfo;
  115. TPrInfo = RECORD
  116.     iDev: INTEGER;                        {Font mgr/QuickDraw device code}
  117.     iVRes: INTEGER;                     {Resolution of device, in device coordinates}
  118.     iHRes: INTEGER;                     {..note: V before H => compatable with Point.}
  119.     rPage: Rect;                        {The page (printable) rectangle in device coordinates.}
  120.     END;
  121.  
  122. { Print Info Record: The parameters needed for page composition. }
  123. TPPrStl = ^TPrStl;
  124. TPrStl = RECORD
  125.     wDev: INTEGER;                        {The device (driver) number. Hi byte=RefNum, Lo byte=variant. f0 = fHiRes f1 = fPortrait, f2 = fSqPix, f3 = f2xZoom, f4 = fScroll.}
  126.     iPageV: INTEGER;                    {paper size in units of 1/iPrPgFract}
  127.     iPageH: INTEGER;                    { ..note: V before H => compatable with Point.}
  128.     bPort: SignedByte;                    {The IO port number. Refnum?}
  129.     feed: TFeed;                        {paper feeder type.}
  130.     END;
  131.  
  132. { Printer Style: The printer configuration and usage information. }
  133. TPPrXInfo = ^TPrXInfo;
  134. TPrXInfo = RECORD
  135.     iRowBytes: INTEGER;
  136.     iBandV: INTEGER;
  137.     iBandH: INTEGER;
  138.     iDevBytes: INTEGER;
  139.     iBands: INTEGER;
  140.     bPatScale: SignedByte;
  141.     bUlThick: SignedByte;
  142.     bUlOffset: SignedByte;
  143.     bUlShadow: SignedByte;
  144.     scan: TScan;
  145.     bXInfoX: SignedByte;
  146.     END;
  147.  
  148. TPPrJob = ^TPrJob;
  149. TPrJob = RECORD
  150.     iFstPage: INTEGER;
  151.     iLstPage: INTEGER;
  152.     iCopies: INTEGER;
  153.     bJDocLoop: SignedByte;
  154.     fFromUsr: BOOLEAN;
  155.     pIdleProc: ProcPtr;
  156.     pFileName: StringPtr;
  157.     iFileVol: INTEGER;
  158.     bFileVers: SignedByte;
  159.     bJobX: SignedByte;
  160.     END;
  161.  
  162. TPrFlag1 = PACKED RECORD
  163.     f15: BOOLEAN;
  164.     f14: BOOLEAN;
  165.     f13: BOOLEAN;
  166.     f12: BOOLEAN;
  167.     f11: BOOLEAN;
  168.     f10: BOOLEAN;
  169.     f9: BOOLEAN;
  170.     f8: BOOLEAN;
  171.     f7: BOOLEAN;
  172.     f6: BOOLEAN;
  173.     f5: BOOLEAN;
  174.     f4: BOOLEAN;
  175.     f3: BOOLEAN;
  176.     f2: BOOLEAN;
  177.     fLstPgFst: BOOLEAN;
  178.     fUserScale: BOOLEAN;
  179.     END;
  180.  
  181. TPPrint = ^TPrint;
  182. THPrint = ^TPPrint;
  183. TPrint = RECORD
  184.     iPrVersion: INTEGER;
  185.     prInfo: TPrInfo;
  186.     rPaper: Rect;
  187.     prStl: TPrStl;
  188.     prInfoPT: TPrInfo;
  189.     prXInfo: TPrXInfo;
  190.     prJob: TPrJob;
  191.     CASE INTEGER OF
  192.       0:
  193.         (printX: ARRAY [1..19] OF INTEGER);
  194.       1:
  195.         (prFlag1: TPrFlag1;             {a word of flags}
  196.         iZoomMin: INTEGER;
  197.         iZoomMax: INTEGER;
  198.         hDocName: StringHandle);        {current doc's name, nil = front window}
  199.     END;
  200.  
  201. TPPrStatus = ^TPrStatus;
  202. TPrStatus = RECORD
  203.     iTotPages: INTEGER;                 {Total pages in Print File.}
  204.     iCurPage: INTEGER;                    {Current page number}
  205.     iTotCopies: INTEGER;                {Total copies requested}
  206.     iCurCopy: INTEGER;                    {Current copy number}
  207.     iTotBands: INTEGER;                 {Total bands per page.}
  208.     iCurBand: INTEGER;                    {Current band number}
  209.     fPgDirty: BOOLEAN;                    {True if current page has been written to.}
  210.     fImaging: BOOLEAN;                    {Set while in band's DrawPic call.}
  211.     hPrint: THPrint;                    {Handle to the active Printer record}
  212.     pPrPort: TPPrPort;                    {Ptr to the active PrPort}
  213.     hPic: PicHandle;                    {Handle to the active Picture}
  214.     END;
  215.  
  216. { Print Status: Print information during printing. }
  217. TPPfPgDir = ^TPfPgDir;
  218. THPfPgDir = ^TPPfPgDir;
  219. TPfPgDir = RECORD
  220.     iPages: INTEGER;
  221.     iPgPos: ARRAY [0..128] OF LONGINT;    {ARRAY [0..iPfMaxPgs] OF LONGINT}
  222.     END;
  223.  
  224. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  225. TPPrDlg = ^TPrDlg;
  226. TPrDlg = RECORD
  227.     Dlg: DialogRecord;                    {The Dialog window}
  228.     pFltrProc: ProcPtr;                 {The Filter Proc.}
  229.     pItemProc: ProcPtr;                 {The Item evaluating proc.}
  230.     hPrintUsr: THPrint;                 {The user's print record.}
  231.     fDoIt: BOOLEAN;
  232.     fDone: BOOLEAN;
  233.     lUser1: LONGINT;                    {Four longs for user's to hang global data.}
  234.     lUser2: LONGINT;                    {...Plus more stuff needed by the particular printing dialog.}
  235.     lUser3: LONGINT;
  236.     lUser4: LONGINT;
  237.     END;
  238.  
  239. TGnlData = RECORD
  240.     iOpCode: INTEGER;
  241.     iError: INTEGER;
  242.     lReserved: LONGINT;                 {more fields here depending on call}
  243.     END;
  244.  
  245. TRslRg = RECORD
  246.     iMin: INTEGER;
  247.     iMax: INTEGER;
  248.     END;
  249.  
  250. TRslRec = RECORD
  251.     iXRsl: INTEGER;
  252.     iYRsl: INTEGER;
  253.     END;
  254.  
  255. TGetRslBlk = RECORD
  256.     iOpCode: INTEGER;
  257.     iError: INTEGER;
  258.     lReserved: LONGINT;
  259.     iRgType: INTEGER;
  260.     xRslRg: TRslRg;
  261.     yRslRg: TRslRg;
  262.     iRslRecCnt: INTEGER;
  263.     rgRslRec: ARRAY [1..27] OF TRslRec;
  264.     END;
  265.  
  266. TSetRslBlk = RECORD
  267.     iOpCode: INTEGER;
  268.     iError: INTEGER;
  269.     lReserved: LONGINT;
  270.     hPrint: THPrint;
  271.     iXRsl: INTEGER;
  272.     iYRsl: INTEGER;
  273.     END;
  274.  
  275. TDftBitsBlk = RECORD
  276.     iOpCode: INTEGER;
  277.     iError: INTEGER;
  278.     lReserved: LONGINT;
  279.     hPrint: THPrint;
  280.     END;
  281.  
  282. TGetRotnBlk = RECORD
  283.     iOpCode: INTEGER;
  284.     iError: INTEGER;
  285.     lReserved: LONGINT;
  286.     hPrint: THPrint;
  287.     fLandscape: BOOLEAN;
  288.     bXtra: SignedByte;
  289.     END;
  290.  
  291. TPRect = ^Rect;                         { A Rect Ptr }
  292.  
  293. TPBitMap = ^BitMap;                     { A BitMap Ptr }
  294.  
  295. TN = 0..15;                             { a Nibble }
  296.  
  297. TPWord = ^TWord;
  298. THWord = ^TPWord;
  299. TWord = PACKED RECORD
  300.     CASE INTEGER OF
  301.       0:
  302.         (c1,c0: CHAR);
  303.       1:
  304.         (b1,b0: SignedByte);
  305.       2:
  306.         (usb1,usb0: Byte);
  307.       3:
  308.         (n3,n2,n1,n0: TN);
  309.       4:
  310.         (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  311.       5:
  312.         (i0: INTEGER);
  313.     END;
  314.  
  315. TPLong = ^TLong;
  316. THLong = ^TPLong;
  317. TLong = RECORD
  318.     CASE INTEGER OF
  319.       0:
  320.         (w1,w0: TWord);
  321.       1:
  322.         (b1,b0: LONGINT);
  323.       2:
  324.         (p0: Ptr);
  325.       3:
  326.         (h0: Handle);
  327.       4:
  328.         (pt: Point);
  329.     END;
  330.  
  331.  
  332.  
  333. PROCEDURE PrPurge;
  334.     INLINE $2F3C,$A800,$0000,$A8FD;
  335. PROCEDURE PrNoPurge;
  336.     INLINE $2F3C,$B000,$0000,$A8FD;
  337. FUNCTION PrDrvrDCE: Handle;
  338.     INLINE $2F3C,$9400,$0000,$A8FD;
  339. FUNCTION PrDrvrVers: INTEGER;
  340.     INLINE $2F3C,$9A00,$0000,$A8FD;
  341. PROCEDURE PrOpen;
  342.     INLINE $2F3C,$C800,$0000,$A8FD;
  343. PROCEDURE PrClose;
  344.     INLINE $2F3C,$D000,$0000,$A8FD;
  345. PROCEDURE PrintDefault(hPrint: THPrint);
  346.     INLINE $2F3C,$2004,$0480,$A8FD;
  347. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  348.     INLINE $2F3C,$5204,$0498,$A8FD;
  349. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  350.     INLINE $2F3C,$2A04,$0484,$A8FD;
  351. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  352.     INLINE $2F3C,$3204,$0488,$A8FD;
  353. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  354.     INLINE $2F3C,$5804,$089C,$A8FD;
  355. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  356.     INLINE $2F3C,$0400,$0C00,$A8FD;
  357. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  358.     INLINE $2F3C,$0800,$0484,$A8FD;
  359. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  360.     INLINE $2F3C,$1000,$0808,$A8FD;
  361. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  362.     INLINE $2F3C,$1800,$040C,$A8FD;
  363. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  364.     VAR prStatus: TPrStatus);
  365.     INLINE $2F3C,$6005,$1480,$A8FD;
  366. FUNCTION PrError: INTEGER;
  367.     INLINE $2F3C,$BA00,$0000,$A8FD;
  368. PROCEDURE PrSetError(iErr: INTEGER);
  369.     INLINE $2F3C,$C000,$0200,$A8FD;
  370. PROCEDURE PrGeneral(pData: Ptr);
  371.     INLINE $2F3C,$7007,$0480,$A8FD;
  372. PROCEDURE PrDrvrOpen;
  373.     INLINE $2F3C,$8000,$0000,$A8FD;
  374. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: ProcPtr): BOOLEAN;
  375.     INLINE $2F3C,$4A04,$0894,$A8FD;
  376. PROCEDURE PrDrvrClose;
  377.     INLINE $2F3C,$8800,$0000,$A8FD;
  378. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  379.     INLINE $2F3C,$4404,$0410,$A8FD;
  380. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  381.     lParam3: LONGINT);
  382.     INLINE $2F3C,$A000,$0E00,$A8FD;
  383. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  384.     INLINE $2F3C,$3C04,$040C,$A8FD;
  385.  
  386.     { UsingPrintTraps }
  387.  
  388.  
  389.     IMPLEMENTATION
  390. END.
  391.  
  392.  
  393.